local path "C:\Users\pgi1\Dropbox\Coal 2021 _ Joe Peter\Bank Regressions\"
cd "`path'\data"
set seed 100
set more off
clear


use loan_year_vars_dataset, clear
sum total_esg_score environment_score  social_score governance_score
keep if !mi(total_esg_score )

gen t=year-minpolicyyear

tab t

keep if t>=-5 & t<=5
keep if !mi(total_esg_score)

bysort ultimateparentid: gen n=_n
count if n==1


collapse total_esg_score environment_score  social_score governance_score, by(t)



twoway (scatter  total_esg_score t , connect(l) lpattern(solid) msymbol(O) color(black)  lwidth(medthick)) /// 
(scatter  environment_score t , connect(l) lpattern(dash) msymbol(S) color(red)  lwidth(medthick)) /// 
(scatter  social_score t , connect(l) lpattern(shortdash) msymbol(D) color(green)  lwidth(medthick)) /// 
(scatter  governance_score t , connect(l) lpattern(longdash) msymbol(T) color(blue)  lwidth(medthick)) /// 
, scheme(s2mono) graphregion(fcolor(white)) bgcolor(white)  xlabel(-5(1)5) xtitle("Event Time") ytitle("Score") ///
ylabel(50 (5) 85, nogrid ) xline(0,lpattern(dash) lcolor(blue) lwidth(thin)) ///
yline(50 (5) 85, lpattern(shortdash) lcolor(gs10) lwidth(thin)) ///
legend( row(2) order(1 2 3 4) lab(1 "Total ESG Score") lab(2 "Environmental Score") lab(3 "Social Score") lab(4 "Governance Score") )  ///
ysize(3.75) xsize(5)

graph export  "`path'\figures\figure5.emf", as(emf) replace

